package net.oschina.simpleplus.util;

public class TimeUtils {
	
	private static TimeDataSource timeDataSource = new TimeDataSource(0);

	private static class TimeDataSource {
		private final long offset;

		public TimeDataSource(long offset) {
			super();
			this.offset = offset;
		}
		
		public long currentTimeMillis(){
			return System.currentTimeMillis() + offset;
		}
	}
	
	public static long currentTimeMillis(){
		return timeDataSource.currentTimeMillis();
	}
	
	public static void changeTime(long timeMills){
		timeDataSource = new TimeDataSource(timeMills - System.currentTimeMillis());
	}
}
